<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="webTest.Person" %>
<%--
  Created by IntelliJ IDEA.
  User: IFT8
  Date: 2015/3/8
  Time: 10:13
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body>
<h3>变量</h3><hr>
<%
    String name = "Name";
    pageContext.setAttribute("name", name);
%>
name= ${name}
<hr><h3>数组</h3><hr>
<%
    String[] names = {"Nm1", "Nm2"};
    pageContext.setAttribute("names", names);
%>
names= ${names} <br>
names[0]= ${names[0]}
<hr><h3>集合</h3><hr>
<%
    List<String> list =new ArrayList<String>();
    list.add("L1");
    list.add("L2");
    list.add("L3");
    pageContext.setAttribute("list", list);
%>
list= ${list} <br>
list[0]= ${list[0]}
<hr><h3>Map</h3><hr>
<%
    Map<String, String> map =new HashMap<String,String>();
    map.put("name", "name0");
    map.put("age", "1");
    pageContext.setAttribute("map", map);
%>
map= ${map} <br>
map["name"]= ${map["name"]} <br>
map.age= ${map.age}
<hr><h3>JavaBean</h3><hr>
<%
    Person person=new Person();
    person.setAge(18);
    person.setName("personName");
    pageContext.setAttribute("person",person);
%>
person.name=${person.name} <br>
person["age"]=${person["age"]}
</body>
</html>
